﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace teach
{
    public partial class PanelBase : UserControl
    {
        public delegate void QuestionAnsweredHandler(object answer);
        public event QuestionAnsweredHandler QuestionAnswered;
        public event EventHandler NextClicked;
        public event EventHandler Timeout;

        protected bool m_answered = false;
        protected Question m_currentQuestion = null;
        protected string m_additionalResourcePath = null;

        public PanelBase()
        {
            InitializeComponent();
        }

        public virtual void SetQuestion(Question question){}
        public virtual void SetStatusImage(bool success, Image image) { }
        public virtual Control GetAnswerControl() 
        {
            return null;
        }

        public virtual void SetAdditionalResourcePath(string path)
        {
            m_additionalResourcePath = path;
        }

        public void RaiseAnswer(object answer)
        {
            QuestionAnswered(answer);
        }

        public void RaiseNextClicked()
        {
            NextClicked(this, null);
        }

        private void timeoutMeter_Tick(object sender, EventArgs e)
        {
            Timeout(this, null);
        }

    }
}
